#!/usr/bin/env bash

set -e

_dir="$(dirname "${BASH_SOURCE[0]}")"

to_run="${@:-thread http}"

if [[ $to_run == *"thread"* ]]; then
	"${_dir}"/thread
fi

if [[ $to_run == *"http"* ]]; then
	"${_dir}"/http --daemon
	sleep 2
	"${_dir}"/client 8001
	set +e
	pkill -f 'wsgi:app' # pkill not present on manylinux_2_24_x86_64
	set -e
fi
